package com.lcq.demo.controller;

import com.lcq.demo.common.utils.RedisUtil;
import com.lcq.demo.entity.po.Device;
import com.lcq.demo.service.DeviceService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test")
//@CrossOrigin(origins = "*")
public class TestController {

    @Resource
    private RedisUtil redisUtil;

    @Resource
    private DeviceService deviceService;

    @GetMapping("/get")
    public String get() {
        return redisUtil.get("list");
    }

    @PostMapping("/add")
    public void test(@RequestBody Device device) {
        deviceService.insert(device);
    }

}
